{include_core file="m/lib/header.html" type="check_identity" title="验证身份" }
<div class="find-pwd-page">
  <div class="find-pwd">
  	{if $username_type == 'email'}
  	<div class="step4">
          <h2 class="prompt prompt2"><i class="ok-icon"></i>确认邮件已发送</h2>
          <h2 class="prompt prompt3">请访问邮箱：{user_helper::hide_email($user_info.email)}进行验证</h2>
          <div class="btns"><a href="{AnUrl('')}" class="btn disabled">返回首页</a></div>
      </div>
      {else}
      <div class="step2">
          <h2 class="prompt">请点击获取验证码并在手机：{user_helper::hide_mobile($user_info.mobile)} 中查看短信，并填写验证码</h2>
          <form action="{AnUrl('user/getback/set_newpass')}" method="post" id="js_passBtn">
          <input type="hidden" name="user_id" value="{$user_info.id}" />
          <p class="txt-wrap"><input type="text" name="mobile_code" id="js_mobileCode" placeholder="请输入短信口令" /><a href="javascript:void(0);" class="get-btn" value="on">获取验证码</a></p>
          <div class="btns"><a href="javascript:void(0);" id="js_nextBtn" class="btn disabled">下一步</a></div>
          </form>
      </div>
      {/if}
  </div>
</div>
<script>
$(function(){
  $('#js_nextBtn').click(function(){
    var mobile_code = $.trim($('#js_mobileCode').val());
    if(mobile_code == '') {
        mobileShowMsg('手机验证码不能为空');
        return ;
    }
    
    $.post(
        '{AnUrl("user/getback/set_newpass")}',
        { mobile_code:mobile_code, user_id:{$user_info.id} },
        function(data){
          if(data.info == 'error') {
            mobileShowMsg(data.msg);
            return;
          } else {
            $('#js_passBtn').submit();
          }
        },'json');
  });
  //获取验证码
  $('.find-pwd .step2 .txt-wrap .get-btn').click(function(){
      if($(this).attr('value') == 'on') {
        var time = 59;
        $('.find-pwd .step2 .txt-wrap .get-btn').html(time).attr('value', 'off');
        var Timer=setInterval(function(){
          if(time > 0){
            time--;
            $('.find-pwd .step2 .txt-wrap .get-btn').html(time).attr('value', 'off');
          } else {
            $('.find-pwd .step2 .txt-wrap .get-btn').html('获取验证码').attr('value', 'on');
            clearInterval(Timer);
          }
        },1000);
      $.post(
          "{AnUrl('user/getback/get_mobile_code')}",
          { mobile:{$user_info.mobile}, 'send_type':'getback' },
          function(data){
            if(data.info == 'error') {
              mobileShowMsg(data.msg);
            }
          },'json'
          );
      }
  });
  
});
</script>
{include_core file="m/lib/footer.html" type="check_identity" title="验证身份" }